#ifndef TIMER_H
#define TIMER_H

#include "NonCopyable.h"
#include "Singleton.h"

class Timer : public NonCopyable
{
public:
	void Start();
	void Stop();
	void Update(); 
	void Reset();
	void Continue();

	bool IsStopped() {return m_TimerStopped;}
	float GetFPS() {return m_Fps;}
	float GetRunningTime() {return m_RunningTime;}
	float GetDtTime(); 

	void SetRunningTime(__int64 runningTime);

private:
	Timer();
	friend class Singleton<Timer>;

private:	
	__int64 m_BaseTicks; 
	__int64 m_StopTicks; 
	__int64 m_TicksPerSecond; 

	__int64 m_LastFPSUpdate;
	float m_FPSUpdateInterval;
	
	float m_RunningTime;
	float m_FrameTime; 	
	float m_Dt;

	float m_Fps;
	unsigned int m_NumFrames;
	
	bool m_TimerStopped;
};

typedef Singleton<Timer> TheTimer;

#endif